package month4.day5.xingzuang;

import java.util.Scanner;

public class GraphText {
    public static void main(String[] args) {
        System.out.println("请输入画图工具类型");
        Scanner in=new Scanner(System.in);
        String type=in.next();
        System.out.println("请输入画图工具价格");
        int money=in.nextInt();
        Paint paint=new Paint(type,money);
        paint.draw();
        while (true){
            System.out.println("请选择计算形状"+"\n1：圆，2：长方形，3：三角形，4：退出");
            int num=in.nextInt();
            if(num==1){
                System.out.println("请输入圆的半径");
                double r=in.nextInt();
                Graph circle=new Circle(r);
                System.out.println("圆的周长"+circle.c());
                System.out.println("圆的面积"+circle.s());
            }else if(num==2){
                System.out.println("请输入长方形的长");
                double chang=in.nextInt();
                System.out.println("请输入长方形的宽");
                double kuan=in.nextInt();
                Graph rectangle=new Rectangle(chang,kuan);
                System.out.println("圆的周长"+rectangle.c());
                System.out.println("圆的面积"+rectangle.s());
            }else if(num==3){
                System.out.println("请输入三角形的第1条边");
                double r1=in.nextInt();
                System.out.println("请输入三角形的第2条边");
                double r2=in.nextInt();
                System.out.println("请输入三角形的第3条边");
                double r3=in.nextInt();
                Triangle triangle=new Triangle(r1,r2,r3);
                if(triangle.a()){
                    System.out.println("圆的周长"+triangle.c());
                    System.out.println("圆的面积"+triangle.s());
                }else {
                    System.out.println("输入的三边不能构成三角形");
                }

            }else{
                return;
            }
        }
    }
}
